package utils.files;

import java.io.File;

import constantes.Consts;

public class FileManagerFlowers extends FileManager {
	
	public static String flower=null;
	
	public static String Pistil=null;
	
	public static String petal=null;
	
	public static String sepal=null;
	
	public static String stamen=null;
	
	public static String receptacle=null;
	
	public static void createResourceFolder(){
		File file = new File(Consts.TEXTURE_PETALS_FOLDER);
		file.mkdirs();
		file = new File(Consts.TEXTURE_PISTILS_FOLDER);
		file.mkdirs();
		file = new File(Consts.TEXTURE_SEPALS_FOLDER);
		file.mkdirs();
		file = new File(Consts.TEXTURE_RECEPTACLES_FOLDER);
		file.mkdirs();
		file = new File(Consts.TEXTURE_STAMENS_FOLDER);
		file.mkdirs();
		file = new File(Consts.SAVE_PETALS_FOLDER);
		file.mkdirs();
		file = new File(Consts.SAVE_PISTILS_FOLDER);
		file.mkdirs();
		file = new File(Consts.SAVE_RECEPTACLES_FOLDER);
		file.mkdirs();
		file = new File(Consts.SAVE_SEPALS_FOLDER);
		file.mkdirs();
		file = new File(Consts.SAVE_STAMENS_FOLDER);
		file.mkdirs();
		file = new File(Consts.SAVE_FLOWERS_FOLDER);
		file.mkdirs();
		file = new File(Consts.FOLDER_IMAGES);
		file.mkdirs();
		file = new File(Consts.FOLDER_LOG);
		file.mkdirs();
		file = new File(Consts.FOLDER_TMP_PETALS);
		file.mkdirs();
		file = new File(Consts.FOLDER_TMP_PISTILS);
		file.mkdirs();
		file = new File(Consts.FOLDER_TMP_RECEPTACLES);
		file.mkdirs();
		file = new File(Consts.FOLDER_TMP_SEPALS);
		file.mkdirs();
		file = new File(Consts.FOLDER_TMP_STAMENS);
		file.mkdirs();
		file = new File(Consts.FOLDER_TMP_FLOWERS);
		file.mkdirs();
	}

	public static String getFlower() {
		return flower;
	}

	public static String setFlower(File source,String name) {
		FileManagerFlowers.delete(Consts.FOLDER_TMP_FLOWERS);
		File file = new File(Consts.FOLDER_TMP_FLOWERS);
		file.mkdirs();
		FileManagerFlowers.flower = source.getAbsolutePath();
		String tempFolder = Consts.FOLDER_TMP_FLOWERS+name+"/";
		file = new File(tempFolder);
		file.mkdir();
		if(source.getAbsolutePath()!=null)
			FileManagerFlowers.unZipComponent(source.getAbsolutePath(), tempFolder);
		return tempFolder;
	}

	public static String getPistil() {
		return Pistil;
	}

	public static String setPistil(String path) {
		FileManagerFlowers.delete(Consts.FOLDER_TMP_PISTILS);
		File file = new File(Consts.FOLDER_TMP_PISTILS);
		file.mkdirs();
		Pistil = path;
		if(path!=null)
			FileManagerFlowers.unZipComponent(path, Consts.FOLDER_TMP_PISTILS);
		return Consts.FOLDER_TMP_PISTILS;
	}

	public static String getPetal() {
		return petal;
	}

	public static String setPetal(String path) {
		FileManagerFlowers.delete(Consts.FOLDER_TMP_PETALS);
		File file = new File(Consts.FOLDER_TMP_PETALS);
		file.mkdirs();
		FileManagerFlowers.petal = path;
		if(path!=null)
			FileManagerFlowers.unZipComponent(path, Consts.FOLDER_TMP_PETALS);
		return Consts.FOLDER_TMP_PETALS;
	}

	public static String getSepal() {
		return sepal;
	}

	public static String setSepal(String path) {
		FileManagerFlowers.delete(Consts.FOLDER_TMP_SEPALS);
		File file = new File(Consts.FOLDER_TMP_SEPALS);
		file.mkdirs();
		FileManagerFlowers.sepal = path;
		if(path!=null)
			FileManagerFlowers.unZipComponent(path, Consts.FOLDER_TMP_SEPALS);
		return Consts.FOLDER_TMP_SEPALS;
	}

	public static String getStamen() {
		return stamen;
	}

	public static String setStamen(String path) {
		FileManagerFlowers.delete(Consts.FOLDER_TMP_STAMENS);
		File file = new File(Consts.FOLDER_TMP_STAMENS);
		file.mkdirs();
		FileManagerFlowers.stamen = path;
		if(path!=null)
			FileManagerFlowers.unZipComponent(path, Consts.FOLDER_TMP_STAMENS);
		return Consts.FOLDER_TMP_STAMENS;
	}

	public static String getReceptacle() {
		return receptacle;
	}

	public static String setReceptacle(String path) {
		FileManagerFlowers.delete(Consts.FOLDER_TMP_RECEPTACLES);
		File file = new File(Consts.FOLDER_TMP_RECEPTACLES);
		file.mkdirs();
		FileManagerFlowers.receptacle = path;
		if(path!=null)
			FileManagerFlowers.unZipComponent(path, Consts.FOLDER_TMP_RECEPTACLES);
		return Consts.FOLDER_TMP_RECEPTACLES;
	}
}
